import 'package:guochaoapp/model/paymentinit_entity.dart';

paymentinitEntityFromJson(PaymentinitEntity data, Map<String, dynamic> json) {
	if (json['success'] != null) {
		data.success = json['success'];
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['data'] != null) {
		data.data = new PaymentinitData().fromJson(json['data']);
	}
	if (json['sign'] != null) {
		data.sign = json['sign'];
	}
	return data;
}

Map<String, dynamic> paymentinitEntityToJson(PaymentinitEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['success'] = entity.success;
	data['msg'] = entity.msg;
	data['code'] = entity.code;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['sign'] = entity.sign;
	return data;
}

paymentinitDataFromJson(PaymentinitData data, Map<String, dynamic> json) {
	if (json['openAli'] != null) {
		data.openAli = json['openAli'];
	}
	if (json['openWx'] != null) {
		data.openWx = json['openWx'];
	}
	if (json['openTransfer'] != null) {
		data.openTransfer = json['openTransfer'];
	}
	if (json['openCredit'] != null) {
		data.openCredit = json['openCredit'];
	}
	if (json['payThreshold'] != null) {
		data.payThreshold = json['payThreshold'] is String
				? int.tryParse(json['payThreshold'])
				: json['payThreshold'].toInt();
	}
	if (json['paymentPrice'] != null) {
		data.paymentPrice = json['paymentPrice'] is String
				? double.tryParse(json['paymentPrice'])
				: json['paymentPrice'].toDouble();
	}
	if (json['expireTimeStamp'] != null) {
		data.expireTimeStamp = json['expireTimeStamp'] is String
				? int.tryParse(json['expireTimeStamp'])
				: json['expireTimeStamp'].toInt();
	}
	return data;
}

Map<String, dynamic> paymentinitDataToJson(PaymentinitData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['openAli'] = entity.openAli;
	data['openWx'] = entity.openWx;
	data['openTransfer'] = entity.openTransfer;
	data['openCredit'] = entity.openCredit;
	data['payThreshold'] = entity.payThreshold;
	data['paymentPrice'] = entity.paymentPrice;
	data['expireTimeStamp'] = entity.expireTimeStamp;
	return data;
}